import API from './API.js'
import {credentials} from '@grpc/grpc-js'
import { promisify } from 'util'

const api = new API.Rag(
  process.env.GRPC_IP_PORT,
  credentials.createInsecure()
);


Object.getOwnPropertyNames(Object.getPrototypeOf(api)).forEach((name) => {
  if(name!='constructor'){
    api[name] = promisify(api[name].bind(api))
  }
})

export default api
